package org.dawfinn.droiditarian;

import java.io.IOException;
import java.util.Date;

import org.dawfinn.droiditarian.data.DeedsDBAdapter;
import org.dawfinn.droiditarian.deedsource.DeedSource;

public class DeedsUpdater {

	private final DeedsDBAdapter db;
	private final DeedSource source;

	public DeedsUpdater(DeedsDBAdapter db, DeedSource source) {
		this.db = db;
		this.source = source;
	}

	public boolean update() throws IOException {
		return db.insertDeeds(source.getDeeds());
	}

	public boolean update(Date beforeDate) throws IOException {
		return db.insertDeeds(source.getDeeds(beforeDate));
	}
}
